import tkinter as tk
from PIL import Image, ImageTk
from link import *
from parameter import *
from admini import showOrderList, user_info_list

class administratePage():
    def __init__(self, master=None):
        self.window = master
        self.window.title('管理员界面')
        self.window.geometry('700x394')
        self.create_page()

    def create_page(self):
        global image
        self.page = tk.Frame(self.window, width=700, height=394)
        self.page.pack()
        img = Image.open('violet.jpg')
        image = ImageTk.PhotoImage(img)
        label_img = tk.Label(self.page, image=image)
        label_img.pack()

        tk.Button(self.page, text='查看用户信息', font=('楷体', 20), bg='CornflowerBlue', fg='Moccasin', command=self.user_info).place(x=500, y=100, anchor='nw')
        tk.Button(self.page, text='查看已购列表', font=('楷体', 20), bg='CornflowerBlue', fg='Moccasin', command=self.order_list).place(x=500, y=200, anchor='nw')

    def user_info(self):
        self.page.destroy()
        user_info_list(self.window)
        
    def order_list(self):
        self.page.destroy()
        showOrderList(self.window)

